{extend name="../../index/view/public/layout" /}
{block name="style"}
<link rel="stylesheet" href="__STATIC__/member/css/member.css">
<link rel="stylesheet" href="__STATIC__/member/css/invite.css">
<link rel="stylesheet" href="__STATIC__/member/css/agents.css">
{/block}

{block name="main-container"}
<div class="member-container wrapper clearfix">
    {include file="public/left" /}
    <div class="member-main">
	
	
	<div class="agents_header">
			<div class="invite-main clearfix">
				<div class="left">
					<div class="agents_top title" style="margin-left:-34px;">
						<div class="agent_fl" id="yonghu">
							{in name="$agent_id" value="1,2"}
							<span class="">名下用户(人)</span>
							{else /}
							<span class="">邀请用户(人)</span>
							{/in}
							<a href="javascrpt:;" onmousemove="onTips();" ><i class="icom_tips"></i></a>
							<p>{$count_m}</p>
						</div>
						<div class="agent_fl" id="yongjin">
							{in name="$isAgent" value="1,2"}
							已赚佣金
							{else /}
							邀请奖励
							{/in}(元)<a href="javascrpt:;" onmousemove="onTips_M();" ><i class="icom_tips"></i></a>
							<p>{$count}</p>
						</div>
						{in name="$isAgent" value="1,2"}

						<div class="agent_fl">
							普通用户邀请好友配资即可获得奖励<br/>
							邀请奖励：所邀请用户配资管理费的<span class="color-red">{$mid|get_plus_rate}%</span>
						</div>
						{else/}
						<div class="agent_fl">
							普通用户成为代理商后享受佣金分成<br/>
							佣金比例：所邀请用户资金管理费的<span class="color-red">{$mid|get_plus_rate}%</span>
						</div>

						{/in}
					</div>

					<div class="invite-link">
						您的邀请链接:
						<span>
							<input type="text" id="invite-url" value="{$url}"><button class="copy-btn" data-clipboard-target="#invite-url">复制链接</button>
						</span>
					</div>
					<div class="invite-social">
						通过社交网站邀请好友：
						<div class="bdsharebuttonbox">
							<a href="#" class="bds_more" data-cmd="more"></a>
							<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
							<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
							<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
							<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
						</div>
						<script>window._bd_share_config = {
							"common": {
								"bdSnsKey": {},
								"bdText": "{$share}",
								"bdMini": "2",
								"bdPic": "",
								"bdStyle": "0",
								"bdSize": "16"
							}, "share": {}
						};
						with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
					</div>
				</div>
				<div class="charcode">
					<img src="{$qrcode}" alt="" width='120' height='120'>
					<div>邀请二维码</div>
				</div>
			</div>
		</div>
		
		{in name="$isAgent" value="1,2"}
			<div class="member-main-title clearfix">
				<h4><a href="{:url('index')}">用户管理</a></h4>
				<h3>已赚佣金记录</a></h3>
			</div>
		
		{else /}
			<div class="member-main-title clearfix">
				<h4><a href="{:url('index')}">邀请人记录</a></h4>
				<h3>邀请奖励记录</a></h3>
			</div>
		{/in}

        <table class="table record-table">
            <thead>
					{in name="$agent_id" value="1,2"}
							 <tr>
								<th>发生时间</th>
								<th>返佣来源</th>
								<th width="40%">返佣金额(元)</th>
							</tr>
						{else/}
							<tr>
								<th width="30%">发生时间</th>
								<th>奖励来源</th>
								<th width="40%">奖励金额（元）</th>
							</tr>
						{/in}
           
            </thead>
            <tbody>
            {notempty name="data"}
            {volist name="data" id="val"}
				<tr>
					 <td>{$val.create_time|date="Y-m-d", ###}</td>
					<td>{$val.info} </td>
					<td><span class="text-red">{$val.affect}</span> </td>
				</tr>
            {/volist}
            {else /}
            <tr>
                <td colspan="4">暂无数据</td>
            </tr>
            {/notempty}
            </tbody>
        </table>
        <div class="pages">
            {$data->render()}
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script src="__STATIC__/libs/clipboard/clipboard.js"></script>
<script src="__STATIC__/libs/layer/layer.js"></script>
<script>
	var agent_rate = {$plu_rate};

    var clipboard = new ClipboardJS('.copy-btn');
    clipboard.on('success', function(e) {
        layer.msg("复制成功");
        e.clearSelection();
    });

    clipboard.on('error', function(e) {
        layer.msg("复制失败，请手动复制邀请链接");
    });
	
   clipboard.on('error', function(e) {
        layer.msg("复制失败，请手动复制邀请链接");
    });
	function onTips(){
		layer.tips("<span style='color:#8a6d3b'>通过您邀请注册的用户人数</span>", '#yonghu',{tips:[1,'#efdbb2']});
	}
	function onTips_M(){
		layer.tips("<span style='color:#8a6d3b'>通过您和您名下代理商邀请注册的用户，配资后您所赚取的佣金</span>", '#yongjin',{tips:[1,'#efdbb2']});
	}
	
</script>

{/block}